package com.szq.yygh.cmn.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.szq.yygh.hosp.model.cmn.Dict;
import com.szq.yygh.hosp.vo.cmn.DictEeVo;
import org.springframework.beans.BeanUtils;

/***
 * All rights Reserved, Designed By www.jx-lab.com
 * @Title: DictListener
 * @Description:
 * @author lixy
 * @date 2021/8/19 11:08
 * @version V1.0
 * @Copyright: www.jx-lab.com Inc. All rights reserved.
 * 注意：本内容仅限于众合景轩信息技术有限公司内部传阅，禁止外泄以及用于其他的商业目
 */
public class DictListener extends AnalysisEventListener<DictEeVo> {

    private BaseMapper baseMapper;

    public DictListener(BaseMapper baseMapper) {
        this.baseMapper = baseMapper;
    }

    //一行一行读取数据
    @Override
    public void invoke(DictEeVo dictEeVo, AnalysisContext analysisContext) {
        Dict dict = new Dict();
        BeanUtils.copyProperties(dictEeVo, dict);
        baseMapper.insert(dict);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
